<template>
  <div class="edit-container">
    <el-form ref="form" :model="form">

      <!--      <el-form-item label="时间范围">-->
      <!--        <el-date-picker-->
      <!--            v-model="form.value1"-->
      <!--            type="datetimerange"-->
      <!--            value-format="yyyy-MM-dd HH:mm:ss"-->
      <!--            range-separator="至"-->
      <!--            start-placeholder="开始日期"-->
      <!--            end-placeholder="结束日期"-->
      <!--            @change="handleDateChange">-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
      <el-form-item label="身份角色" prop="roleId">
        <el-select v-model="form.roleId" placeholder="请选择" class="col">
          <el-option
              v-for="item in roleIdList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item class="el-icon-circle-plus-outline"
                    style="margin-top: 60px;width: 100%;display: flex;justify-content: center;">
        <el-button @click="close">取消</el-button>
        <el-button :loading="exportLoading" type="primary" @click="handlerSubmit">导出</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

import {
  downLoadVoucherInfoExcel,
} from "@/api/order";

export default {
  props: {
    id: {
      default: null
    }
  },
  data() {
    return {
      form: {
        // sTime: '',
        // eTime: '',
        roleId:''
      },
      roleIdList: [{id: 3, name: '市代'}, {id: 4, name: '区代'}],
      list: [],
      saveLoading: false,
      countdown: 0,
      exportLoading: false
    }
  },
  mounted() {

  },
  methods: {

    handleDateChange(value) {
      this.form.sTime = value[0];
      this.form.eTime = value[1];
    },
    handlerSubmit() {
      this.$refs.form.validate(valid => {
        if (!valid) return;
        this.saveLoading = true;
        this.exportLoading = true;
        downLoadVoucherInfoExcel(this.form).then(() => {

          this.close();
        }).finally(() => {
          this.saveLoading = false;
          this.exportLoading = false;
        });
      });
    },
    close() {
      this.$emit('hideExportDialog');
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep {
  .el-upload {
  }
}

.img {
  width: 80px;
  height: 80px;
  border-radius: 100px;
}
</style>
